{extend name="public/base"}
{block name="title"}{$info.title|default=''}{/block}
{block name="style"}
  <meta content="yes" name="apple-mobile-web-app-capable" /> 
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> 
  <meta content="black" name="apple-mobile-web-app-status-bar-style" /> 
  <meta name="format-detection" content="telephone=no" /> 
  <meta name="full-screen" content="yes" /> 
  <meta name="x5-fullscreen" content="true" /> 
  <script type="text/javascript" src="/public/novel/js/jquery.min.js"></script>
	 <script type="text/javascript">
      !function(a,b){function c(){var b=f.getBoundingClientRect().width;b/i>540&&(b=540*i);var c=b/10;f.style.fontSize=c+"px",k.rem=a.rem=c}var d,e=a.document,f=e.documentElement,g=e.querySelector('meta[name="viewport"]'),h=e.querySelector('meta[name="flexible"]'),i=0,j=0,k=b.flexible||(b.flexible={});if(g){console.warn("将根据已有的meta标签来设置缩放比例");var l=g.getAttribute("content").match(/initial\-scale=([\d\.]+)/);l&&(j=parseFloat(l[1]),i=parseInt(1/j))}else if(h){var m=h.getAttribute("content");if(m){var n=m.match(/initial\-dpr=([\d\.]+)/),o=m.match(/maximum\-dpr=([\d\.]+)/);n&&(i=parseFloat(n[1]),j=parseFloat((1/i).toFixed(2))),o&&(i=parseFloat(o[1]),j=parseFloat((1/i).toFixed(2)))}}if(!i&&!j){var p=a.navigator.userAgent,q=(!!p.match(/android/gi),!!p.match(/iphone/gi)),r=q&&!!p.match(/OS 9_3/),s=a.devicePixelRatio;i=q&&!r?s>=3&&(!i||i>=3)?3:s>=2&&(!i||i>=2)?2:1:1,j=1/i}if(f.setAttribute("data-dpr",i),!g)if(g=e.createElement("meta"),g.setAttribute("name","viewport"),g.setAttribute("content","initial-scale="+j+", maximum-scale="+j+", minimum-scale="+j+", user-scalable=no"),f.firstElementChild)f.firstElementChild.appendChild(g);else{var t=e.createElement("div");t.appendChild(g),e.write(t.innerHTML)}a.addEventListener("resize",function(){clearTimeout(d),d=setTimeout(c,300)},!1),a.addEventListener("pageshow",function(a){a.persisted&&(clearTimeout(d),d=setTimeout(c,300))},!1),"complete"===e.readyState?e.body.style.fontSize=12*i+"px":e.addEventListener("DOMContentLoaded",function(){e.body.style.fontSize=12*i+"px"},!1),c(),k.dpr=a.dpr=i,k.refreshRem=c,k.rem2px=function(a){var b=parseFloat(a)*this.rem;return"string"==typeof a&&a.match(/rem$/)&&(b+="px"),b},k.px2rem=function(a){var b=parseFloat(a)/this.rem;return"string"==typeof a&&a.match(/px$/)&&(b+="rem"),b}}(window,window.lib||(window.lib={}));
    </script> 
  <link rel="stylesheet" href="/public/css/activity/common.css?0bfededf" /> 
  <link rel="stylesheet" href="/public/css/activity/vipRecharge.css?bfd75466" /> 
{/block}
{block name="body"}
  <section id="root">
   <div data-reactroot="" class="g-wrap" id="vipRechargeApp">
    <div class="m-countdown settime" endTime="{notempty name="info.endtime"}{$info.endtime|date='Y-m-d H:i:s',###}{/notempty}">
    </div>
    <img class="m-header" src="{notempty name="info.cover"}{$info.cover}{/notempty}" />
    <div class="m-vipRechargeItem" id="vipRechargeItem">
     <div></div>
		
     {notempty name="info"}
		 {volist name="info['page']" id="vo"}
		 <div class="m-rechargeCard">
		  <div class="inner">
		   <div class="m-title 
		   {switch name="vo.type" }
		   {case value="2"}m-title-vip{/case}
		   {case value="3"}m-title-vip2{/case}
		   {case value="4"}m-title-vip3{/case}
			{default /}
			{/switch}"></div>
		   <h3 class="red">{$vo.description}</h3>
		   {if $vo['type']==1}
		   <p>
			得{$vo['egold']+$vo['giveegold']}阅点<br />
			{$vo.egold}阅读币 + {$vo.giveegold}赠送
		   </p>
		   {/if}
		   <a href="javascript:;" class="btn-recharge" data-money='{$vo.price}'>
			&yen;&nbsp;&nbsp;<b>{$vo.price}</b></a>
		  </div>
		 </div>
		{/volist}
	{/notempty}
    </div>
    <div class="m-vip-rule">
     <h5>活动规则</h5>
		{$info.rules|default=''}
     <img src="{$qrcode}" />
    </div>
   </div>
  </section> 



{/block}
{block name="script"}
<script type="text/javascript">
	var loginurl = "/login?backurl={$backurl}";
	var jumpurl = "{$backurl}";
	var login = {$uid|default=0};
	var payurl = "http://{:config('agent_payurl')}";
	var pay_change = {:config('pay_change')};

	$(function(){
		$('.btn-recharge').click(function(){
			var money = $(this).data('money');
			var endtime = {$info.endtime|default=0};
			var nowtime = new Date().getTime().toString();
			nowtime = nowtime.substr(0,10);
			if(endtime >nowtime){
				var ua = navigator.userAgent.toLowerCase();
				if(ua.match(/MicroMessenger/i)=="micromessenger") {  
					if (pay_change==1)
					{
						var url = payurl+'/pay/pay.html?egold='+money+'&type=3&jumpurl='+jumpurl;
					}else{
						var url = payurl+'/pay/thirdpay.html?egold='+money+'&type=3&jumpurl='+jumpurl;
					}
				} else {  
					var url = payurl+'/alipay/pay.html?egold='+money+'&type=3&jumpurl='+jumpurl;
				} 

				if(login)
				{
					document.location.href=url
				}else{
					document.location.href=loginurl	
				}
			}else{
				layer.msg("活动已结束!");
			}

		})

	})
	function updateEndTime()
	{
		var date = new Date();
		var time = date.getTime(); //当前时间距1970年1月1日之间的毫秒数
		var endDate =$('.settime').attr("endTime"); //结束时间字符串
		var html='';
		//转换为时间日期类型
		//console.log(endDate);
		var endDate1 = eval('new Date(' + endDate.replace(/\d+(?=-[^-]+$)/,
		function (a) { return parseInt(a, 10) - 1; }).match(/\d+/g) +')');
			var endTime = endDate1.getTime(); //结束时间毫秒数
			var lag = (endTime - time) / 1000; //当前时间和结束时间之间的秒数
			if(lag > 0)
			{
				var second = Math.floor(lag % 60); 
				var minite = Math.floor((lag / 60) % 60);
				var hour = Math.floor((lag / 3600) % 24);
				var day = Math.floor((lag / 3600) / 24);
				html +='<span class="text">抢购倒计时: </span>';
				html +='<span><span class="time">'+day+'</span>天</span>';
				html +='<span><span class="time">'+hour+'</span>时</span>';
				html +='<span><span class="time">'+minite+'</span>分</span>';
				html +=' <span><span class="time">'+second+'</span>秒</span>';
				$('.settime').html(html);
				}else{
				$(this).removeClass("settime");
				//alert($(this).attr("id"));
				$('.settime').html('<span class="text">已经结束啦！</span>');
			}

		setTimeout("updateEndTime()",1000);

	}
	$(function(){
		updateEndTime();
	});
</script>
{/block}
